package com.share.device.service.impl;

import java.util.List;
import com.share.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.share.device.mapper.PowerBankMapper;
import com.share.device.domain.PowerBank;
import com.share.device.service.IPowerBankService;

/**
 * 充电宝Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-24
 */
@Service
public class PowerBankServiceImpl implements IPowerBankService 
{
    @Autowired
    private PowerBankMapper powerBankMapper;

    /**
     * 查询充电宝
     * 
     * @param id 充电宝主键
     * @return 充电宝
     */
    @Override
    public PowerBank selectPowerBankById(Long id)
    {
        return powerBankMapper.selectPowerBankById(id);
    }

    /**
     * 查询充电宝列表
     * 
     * @param powerBank 充电宝
     * @return 充电宝
     */
    @Override
    public List<PowerBank> selectPowerBankList(PowerBank powerBank)
    {
        return powerBankMapper.selectPowerBankList(powerBank);
    }

    /**
     * 新增充电宝
     * 
     * @param powerBank 充电宝
     * @return 结果
     */
    @Override
    public int insertPowerBank(PowerBank powerBank)
    {
        powerBank.setCreateTime(DateUtils.getNowDate());
        return powerBankMapper.insertPowerBank(powerBank);
    }

    /**
     * 修改充电宝
     * 
     * @param powerBank 充电宝
     * @return 结果
     */
    @Override
    public int updatePowerBank(PowerBank powerBank)
    {
        powerBank.setUpdateTime(DateUtils.getNowDate());
        return powerBankMapper.updatePowerBank(powerBank);
    }

    /**
     * 批量删除充电宝
     * 
     * @param ids 需要删除的充电宝主键
     * @return 结果
     */
    @Override
    public int deletePowerBankByIds(Long[] ids)
    {
        return powerBankMapper.deletePowerBankByIds(ids);
    }

    /**
     * 删除充电宝信息
     * 
     * @param id 充电宝主键
     * @return 结果
     */
    @Override
    public int deletePowerBankById(Long id)
    {
        return powerBankMapper.deletePowerBankById(id);
    }
}
